package com.new1.srp;

/**
 * Time    : 2023/3/24 16:50
 * Author  : 王摇摆
 * FileName: SingleResponsibility.java
 * Software: IntelliJ IDEA 2020.2.2
 * Blog    ：https://blog.csdn.net/weixin_44943389?type=blog
 */

/**
 * 上课的有好学生
 * 也有坏学生
 * 并不是所有学生都在认真听讲
 * <p>
 * 解决方案：设置两个学生类，区分好学生类和坏学生类
 */
public class SingleResponsibility2 {
    public static void main(String[] args) {
        goodStudent2 goodStudent2 = new goodStudent2();
        goodStudent2.attendClass("张三");

        badStudent2 badStudent2 = new badStudent2();
        badStudent2.attendClass("李四");
    }
}

class goodStudent2 {
    public void attendClass(String student) {
        System.out.println(student + "正在认真的听老师讲课！");
    }
}
class badStudent2 {
    public void attendClass(String student) {
        System.out.println(student + "正在课堂上走神睡觉！");
    }
}
